<template>
  <el-form-item>
    <template #label>
      <el-select class="event-select" v-model="optionModel.event2">
        <el-option
          v-for="event in events"
          :key="event.value"
          :label="event.label"
          :value="event.value"
        >
        </el-option>
      </el-select>
    </template>
    <el-button
      type="info"
      icon="el-icon-edit"
      plain
      round
      @click="editEventHandler('event2Code', eventParams)"
    >
      {{ i18nt('designer.setting.addEventHandler') }}</el-button
    >
  </el-form-item>
</template>

<script>
import eventMixin from '@/mixins/eventMixin'

export default {
  name: 'Event2CodeEditor',
  mixins: [eventMixin],
  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object
  },
  data() {
    return {
      events: [
        {
          label: '无',
          value: -1
        },
        {
          label: '按键按下',
          value: 1
        },
        {
          label: '按键抬起',
          value: 8
        },
        {
          label: '按键长按',
          value: 5
        }
      ],
      eventParams: []
    }
  }
}
</script>

<style scoped></style>
